package com.goodsogood.union.auth.util;

import org.apache.commons.lang3.StringUtils;

import java.util.Map;
import java.util.UUID;

/**
 * Created by dongguochao on 30/10/2016.
 */
public class UUIDUtils {
    /**
     * 32位UUID
     */
    public static String uuid32() {
        // 创建 GUID 对象
        UUID uuid = UUID.randomUUID();
        // 得到对象产生的ID
        String a = uuid.toString();
        // 转换为大写
        a = a.toUpperCase();
        return a.replaceAll("-", "");
    }

    /**
     * 32位UUID
     */
    public static String uuid32(Map<String, String> filter) {
        if(StringUtils.isNotEmpty(filter.get("rId"))){
            return filter.get("rId");
        }
        return uuid32();
    }
}
